<?php

/*if (isset($_POST["getMember"]))
{
	$a=load("//".$_POST["getMember"]);
	echo json_encode($a);
    die;
}*/
function load($tem)
{
	$doc = new DOMDocument;
	$doc->load("vnxpress.xml");
	$xpath = new DOMXpath($doc);
	$query=substr($tem,0,-1);
	$node = $xpath->query($query);
	$chuoi='';
	return view($node,$xpath,$query,&$chuoi);
}
function view($node,$xpath,$query,&$chuoi)
{
    foreach($node as $nod)
    {
		
        $chuoi.= "<".$nod->nodeName.">";
		
        if($nod->hasChildNodes())
        {
            
            $nodechid=$nod->childNodes;
            $leng1=$nodechid->length;
            if($leng1>1)
            {
                $mang=array();$k=-1;$tg;
                foreach($nodechid as $no)
                {
                    if($no->nodeName!="#text")
                    {
                        $mang[++$k]=$no->nodeName;$h=0;
                        foreach($mang as $m)
                        {
                            if($m==$no->nodeName)
                            {
                                $h++;
                            }
                        }
                            $query1="/".$no->nodeName."[".$h."]";
                            $node1=$xpath->query($query.$query1);
                            view($node1,$xpath,$query.$query1,&$chuoi);
                    }
                }
            }
            else
            {
                $chuoi.= $nod->nodeValue;
            }
        }
        $chuoi.= "</".$nod->nodeName.">";
    }
    return $chuoi;
}
?>
